#include <iostream>
#include <cmath>
#include <string>

using namespace std;

struct list_node{
    int val;
    struct list_node * next;
};

list_node * input_list(void){
    int n, val;
    list_node * phead = new list_node();
    list_node * cur_pnode = phead;
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i) {
        scanf("%d", &val);
        if (i == 1) {
            cur_pnode->val = val;
            cur_pnode->next = NULL;
        }
        else {
            list_node * new_pnode = new list_node();
            new_pnode->val = val;
            new_pnode->next = NULL;
            cur_pnode->next = new_pnode;
            cur_pnode = new_pnode;
        }
    }
    return phead;
}

list_node * reverse_list(list_node * head, int L, int R){
    list_node whead;
    whead.next = head;
    list_node *pre = &whead, *p = head, *to = p->next;
    int t = 1;
    while(t < L){
        pre = p;
        p = to;
        to = to->next;
        ++t;
    }
    list_node *stopb = pre, *stopc = p;
    pre = nullptr;
    while( t <= R && p) {
        p->next = pre;
        pre = p;
        p = to;
        to = to->next;
        t++;
    }
    stopb->next = pre;
    stopc->next = p;
    return whead.next;
}

void print_list(list_node * head){
    while (head != NULL) {
        printf("%d ", head->val);
        head = head->next;
    }
    puts("");
}

void Test1(){
    int L, R;
    list_node * head = input_list();
    scanf("%d%d", &L, &R);
    list_node * new_head = reverse_list(head, L, R);
    print_list(new_head);
}


void Test2(){
    int n;
    while (cin >> n) {
        if (n == 0) break;
        long total = pow(5, n) - 4;
        long left = pow(4, n) + n - 4;
        cout << total << " " << left << endl;
    }
}

int main() {
    std::cout << "Hello, World!" << std::endl;
    return 0;
}
